package com.dc.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.View;
import org.springframework.web.servlet.view.RedirectView;

@Controller
public class helloController {
   @RequestMapping("/welcome")
    public String welcome()throws  Exception{
       System.out.println("springmvc");
        return "success.jsp";

   };
    @RequestMapping("/welcome2")
    public ModelAndView welcome2()throws  Exception{
        ModelAndView mav= new ModelAndView(
                        "success.jsp",
                        "username",
                        "xxxx时代科技非公开"
        );
        System.out.println("welcome2");
        return mav;
    }
    @RequestMapping("/redirect")
    public ModelAndView welcome3()throws Exception{
        View view=new RedirectView("success.jsp");
        return  new ModelAndView(view);
    }



    @RequestMapping("/error")
    public String error()throws Exception{
        int i=1/0;
        return "";
    }
}





